package be.lreenaers.mirr0r.schema.components.SimpleDublinCore;

import java.util.ArrayList;

import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import be.lreenaers.mirr0r.components.utils.Utils;
import be.lreenaers.mirr0r.schema.components.GenericElement;
import be.lreenaers.mirr0r.schema.components.GenericValue;
import be.lreenaers.mirr0r.schema.components.JdomElement;
import be.lreenaers.mirr0r.schema.interfaces.XmlAttribute;
import be.lreenaers.mirr0r.schema.interfaces.XmlElement;
/**
 * Implement concept of Language according to <a href="http://purl.org/dc/elements/1.1/">http://purl.org/dc/elements/1.1/</a>.
 * 
 * @author Ludovic Reenaers
 * @version 1.0
 * @since 1.1
 *
 */
public class DCLanguageElement extends GenericElement {

	/**
	 * Default Constructor.
	 */
	public DCLanguageElement(){
		
		setUp();
	}
	
	/**
	 * Builds the element up.
	 */
	@Override
	public void setUp() {
		this.panel = new JPanel();
		this.panel.setLayout(new BoxLayout(this.panel, BoxLayout.X_AXIS));
		ImageIcon xmlIcon = Utils.createImageIcon("img/xml-small.png");
		JLabel label = new JLabel(xmlIcon);
		label.setText(Utils.getTranslator().getString("lng"));
		label.setToolTipText(Utils.getTranslator().getString("lng-desc"));
		label.setAlignmentX(JPanel.LEFT_ALIGNMENT);
		this.panel.add(label);
		this.attributes = new ArrayList<XmlAttribute>();
		this.elements = new ArrayList<XmlElement>();
		this.setName(Utils.getTranslator().getString("lng"));
		this.element = new JdomElement("language");
		this.element.setNamespace(Utils.DC_NAMESPACE);
		GenericValue val = new GenericValue();
		this.setValue(val);
	}
}
